如何用PHP运行批处理<.bat>文件或者结束服务器进程

来源:百度知道 编辑:UC知道 时间:2024/06/10 22:23:12
如何用PHP运行批处理文件或者结束服务器进程?
请贴出代码.
我的意思是运行那个页面的时候服务器执行固定路径下的bat或者是exe文件。

可以用system()、exec()、passthru()

string system ( string command [, int &return_var] )

string exec ( string command [, array &output [, int &return_var]] )

void passthru ( string command [, int &return_var] )

没错啊,比如你要在用户访问1.php的时候执行服务器上的 c:\a.bat 你可以在1.php里面这么写

<?php
exec("c:\\a.bat");
?>